import { SaaSBasicPageParams } from '../model/baseModel';
import {
  IamAccountItemGetResultModel,
  IamAccountItem,
  LogListItem,
  LogListItemGetResultModel,
  SaaSIamAccountListItem,
  SaaSIamAccountCreateForm,
  SaaSIamAccountUpdateForm,
} from './model/systemModel';
import { defHttp, tenantHttp } from '/@/utils/http/axios';

enum Api {
  SaaSIamList = '/v1/iam/selectIamList',
  SaaSIamCreate = '/v1/iam/creatIam',
  SaaSIamUpdate = '/v1/iam/updateIam',

  IamList = '/iam/getIamList',
  LogList = '/log/getLogList',
}

export const getSaaSIamList = (params: SaaSBasicPageParams) => {
  // IAM账号列表
  return tenantHttp.get<SaaSIamAccountListItem>({
    url: Api.SaaSIamList,
    params,
  });
};

export const createSaaSIam = (params: SaaSIamAccountCreateForm) => {
  // 添加IAM账号
  return tenantHttp.post<string>({ url: Api.SaaSIamCreate, params });
};

export const updateSaaSIam = (params: SaaSIamAccountUpdateForm) => {
  // 编辑IAM账号
  return tenantHttp.post<string>({ url: Api.SaaSIamUpdate, params });
};

export const getIamList = (params: IamAccountItem) => defHttp.get<IamAccountItemGetResultModel>({ url: Api.IamList, params });

export const getLogList = (params: LogListItem) => defHttp.get<LogListItemGetResultModel>({ url: Api.LogList, params });
